Skip to content

Convert library to ESM#176

Merged
NullVoxPopuli merged 4 commits intomainfrom
copilot/convert-library-to-esm
Mar 15, 2026
Merged

Convert library to ESM#176
NullVoxPopuli merged 4 commits intomainfrom
copilot/convert-library-to-esm

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

  • Add "type": "module" to package.json
  • Rename .eslintrc.js.eslintrc.cjs (uses module.exports)
  • Rename .prettierrc.js.prettierrc.cjs (uses module.exports)
  • Update .eslintrc.cjs to use sourceType: 'module' by default
  • Convert src/utils/document.js to ESM
  • Convert src/preprocessor/noop.js to ESM
  • Convert src/parser/transforms.js to ESM
  • Convert src/parser/ts-patch.js to ESM
  • Convert src/parser/hbs-parser.js to ESM
  • Convert src/parser/gjs-gts-parser.js to ESM
  • lint:package calls publint directly (wired into pnpm lint via npm:lint:*(!fix) glob)
  • All 32 tests pass
  • pnpm lint runs both eslint and publint cleanly

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: NullVoxPopuli <[email protected]>
Copilot AI changed the title [WIP] Convert library to ESM and add publint if necessary Convert library to ESM Mar 15, 2026
Copilot AI requested a review from NullVoxPopuli March 15, 2026 15:30
Comment thread package.json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add publint to lints

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 28bcd98. lint:package (which calls publint) was already wired into pnpm lint via the npm:lint:*(!fix) glob — I updated the script to call publint directly rather than going through pnpm publint.

@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review March 15, 2026 18:22
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 15, 2026

🏎️ Benchmark Comparison

Benchmark Control (avg) Experiment (avg) Δ
gts small 2.11 ms 2.10 ms -0.5%
🟡 gts medium 7.21 ms 7.08 ms -1.7%
🔴 gts large 19.31 ms 20.38 ms +5.6%
🟡 gjs small 1.60 ms 1.57 ms -1.7%
🟡 gjs medium 5.79 ms 5.63 ms -2.9%
🟡 gjs large 13.65 ms 13.92 ms +2.0%
hbs small 200.50 µs 200.40 µs -0.1%
hbs medium 2.56 ms 2.58 ms +0.7%
🔴 hbs large 13.23 ms 15.86 ms +19.8%

🟢 faster · 🔴 slower · 🟡 within 5% · ⚪ within 1%

Full mitata output
clk: ~3.09 GHz
cpu: AMD EPYC 7763 64-Core Processor
runtime: node 24.14.0 (x64-linux)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
gts small (control)            2.11 ms/iter   2.59 ms █                    
                       (1.06 ms … 20.67 ms)   5.71 ms ██▆                  
                    ( 19.84 kb …   2.72 mb) 624.04 kb ████▇▅▃▆▂▂▅▂▃▆▄▁▁▂▁▁▁

gts small (experiment)         2.10 ms/iter   2.44 ms █                    
                       (1.08 ms … 22.21 ms)   5.82 ms █▆▃                  
                    (160.00  b …   1.68 mb) 623.74 kb ████▅▄▄▃▂▃▂▄▂▂▃▂▂▁▂▁▁

                             ┌                                            ┐
                             ╷┌────────┬───┐                             ╷
         gts small (control) ├┤        │   ├─────────────────────────────┤
                             ╵└────────┴───┘                             ╵
                             ╷┌────────┬──┐                               ╷
      gts small (experiment) ├┤        │  ├───────────────────────────────┤
                             ╵└────────┴──┘                               ╵
                             └                                            ┘
                             1.06 ms            3.44 ms             5.82 ms

summary
  gts small (experiment)
   1x faster than gts small (control)

------------------------------------------- -------------------------------
gts medium (control)           7.21 ms/iter   7.93 ms  ▂█                  
                       (3.66 ms … 29.27 ms)  19.28 ms  ██▄ ▆               
                    ( 84.39 kb …  13.10 mb)   2.72 mb ██████▇▂▅▆▂▁▆▂▁▂▁▁▁▁▂

gts medium (experiment)        7.08 ms/iter   8.10 ms  █                   
                       (3.59 ms … 30.09 ms)  27.14 ms ▄██ ▂                
                    (  1.05 mb …  11.92 mb)   2.64 mb █████▅▇▄▂▁▁▁▁▁▁▁▁▂▁▁▂

                             ┌                                            ┐
                             ╷  ┌───┬┐                     ╷
        gts medium (control) ├──┤   │├─────────────────────┤
                             ╵  └───┴┘                     ╵
                             ╷ ┌────┬─┐                                   ╷
     gts medium (experiment) ├─┤    │ ├───────────────────────────────────┤
                             ╵ └────┴─┘                                   ╵
                             └                                            ┘
                             3.59 ms           15.36 ms            27.14 ms

summary
  gts medium (experiment)
   1.02x faster than gts medium (control)

------------------------------------------- -------------------------------
gts large (control)           19.31 ms/iter  23.06 ms  ▃  █                
                      (10.66 ms … 37.20 ms)  36.14 ms  █▇▂█▂ ▇  ▂▂        ▂
                    (  4.74 mb …  17.14 mb)   6.94 mb ▆█████▆█▆▆██▆▁▁▆▁▁▁▁█

gts large (experiment)        20.38 ms/iter  22.45 ms    █                 
                      (10.34 ms … 44.03 ms)  42.06 ms   ▅█      ▂          
                    (  4.59 mb …  19.97 mb)   7.31 mb ▄▇██▇▄▇▇▄▁█▄▁▁▁▁▄▁▄▁▄

                             ┌                                            ┐
                             ╷    ┌───────┬────┐                  ╷
         gts large (control) ├────┤       │    ├──────────────────┤
                             ╵    └───────┴────┘                  ╵
                             ╷     ┌───────┬──┐                           ╷
      gts large (experiment) ├─────┤       │  ├───────────────────────────┤
                             ╵     └───────┴──┘                           ╵
                             └                                            ┘
                             10.34 ms           26.20 ms           42.06 ms

summary
  gts large (control)
   1.06x faster than gts large (experiment)

------------------------------------------- -------------------------------
gjs small (control)            1.60 ms/iter   1.45 ms █                    
                     (855.92 µs … 20.42 ms)   6.98 ms █▂                   
                    ( 53.88 kb …   5.91 mb) 564.34 kb ██▅▃▂▂▂▂▂▂▂▂▁▁▁▁▁▁▁▁▁

gjs small (experiment)         1.57 ms/iter   1.40 ms █                    
                     (888.00 µs … 18.52 ms)   6.83 ms █▃                   
                    ( 11.25 kb …   2.79 mb) 569.32 kb ██▃▃▂▂▂▂▁▂▂▂▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌───┬                                       ╷
         gjs small (control) ├┤   │───────────────────────────────────────┤
                             ╵└───┴                                       ╵
                             ╷┌───┬                                      ╷
      gjs small (experiment) ├┤   │──────────────────────────────────────┤
                             ╵└───┴                                      ╵
                             └                                            ┘
                             855.92 µs           3.92 ms            6.98 ms

summary
  gjs small (experiment)
   1.02x faster than gjs small (control)

------------------------------------------- -------------------------------
gjs medium (control)           5.79 ms/iter   6.17 ms █▆                   
                       (3.12 ms … 29.41 ms)  24.20 ms ██▄▅                 
                    (466.28 kb …  10.89 mb)   2.29 mb ████▃▂▅▂▂▂▁▁▁▁▁▂▁▁▁▁▂

gjs medium (experiment)        5.63 ms/iter   6.17 ms █                    
                       (3.03 ms … 28.49 ms)  24.31 ms █▅                   
                    ( 58.21 kb …  12.34 mb)   2.33 mb ████▄▃▄▄▁▂▁▁▁▁▁▁▁▁▁▁▂

                             ┌                                            ┐
                             ╷┌────┬┐                                     ╷
        gjs medium (control) ├┤    │├─────────────────────────────────────┤
                             ╵└────┴┘                                     ╵
                             ╷┌───┬─┐                                     ╷
     gjs medium (experiment) ├┤   │ ├─────────────────────────────────────┤
                             ╵└───┴─┘                                     ╵
                             └                                            ┘
                             3.03 ms           13.67 ms            24.31 ms

summary
  gjs medium (experiment)
   1.03x faster than gjs medium (control)

------------------------------------------- -------------------------------
gjs large (control)           13.65 ms/iter  14.76 ms ▅ ██                 
                       (7.22 ms … 39.86 ms)  35.15 ms █▇██▂▂▂              
                    (  4.58 mb …   6.83 mb)   5.88 mb ███████▇▄▁▇▁▁▁▁▁▁▇▁▁▄

gjs large (experiment)        13.92 ms/iter  16.99 ms  █▆                  
                       (7.17 ms … 33.26 ms)  32.62 ms  ██ ▂                
                    (  3.71 mb …   8.30 mb)   6.14 mb ▃████▆▁█▆▆▆▃▃▁▁▁▃▃▁▁▃

                             ┌                                            ┐
                             ╷  ┌──────┬─┐                                ╷
         gjs large (control) ├──┤      │ ├────────────────────────────────┤
                             ╵  └──────┴─┘                                ╵
                             ╷  ┌───────┬────┐                        ╷
      gjs large (experiment) ├──┤       │    ├────────────────────────┤
                             ╵  └───────┴────┘                        ╵
                             └                                            ┘
                             7.17 ms           21.16 ms            35.15 ms

summary
  gjs large (control)
   1.02x faster than gjs large (experiment)

------------------------------------------- -------------------------------
hbs small (control)          200.50 µs/iter 128.96 µs █                    
                      (93.65 µs … 24.48 ms)   2.31 ms █                    
                    ( 20.30 kb …   1.53 mb) 131.87 kb █▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

hbs small (experiment)       200.40 µs/iter 130.94 µs █                    
                      (93.74 µs … 20.88 ms)   2.73 ms █                    
                    (  2.50 kb …   1.60 mb) 138.70 kb █▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌─┬                                   ╷
         hbs small (control) │ │───────────────────────────────────┤
                             └─┴                                   ╵
                             ┌─┬                                          ╷
      hbs small (experiment) │ │──────────────────────────────────────────┤
                             └─┴                                          ╵
                             └                                            ┘
                             93.65 µs            1.41 ms            2.73 ms

summary
  hbs small (experiment)
   1x faster than hbs small (control)

------------------------------------------- -------------------------------
hbs medium (control)           2.56 ms/iter   2.32 ms █                    
                       (1.29 ms … 20.84 ms)  19.92 ms █                    
                    (720.13 kb …   4.22 mb)   1.90 mb █▅▂▄▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

hbs medium (experiment)        2.58 ms/iter   2.46 ms █                    
                       (1.32 ms … 20.15 ms)  18.34 ms █                    
                    (913.24 kb …   3.96 mb)   1.98 mb █▆▃▃▄▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌──┬                                         ╷
        hbs medium (control) │  │─────────────────────────────────────────┤
                             └──┴                                         ╵
                             ┌──┬                                     ╷
     hbs medium (experiment) │  │─────────────────────────────────────┤
                             └──┴                                     ╵
                             └                                            ┘
                             1.29 ms           10.60 ms            19.92 ms

summary
  hbs medium (control)
   1.01x faster than hbs medium (experiment)

------------------------------------------- -------------------------------
hbs large (control)           13.23 ms/iter  13.98 ms █                    
                       (7.89 ms … 29.45 ms)  29.35 ms █▃                   
                    (  7.96 mb …   9.71 mb)   8.53 mb ██▆█▄▆▃▁▄▃▃▃▁▁▁▁▃▄▃▃▃

hbs large (experiment)        15.86 ms/iter  19.72 ms █                    
                       (9.02 ms … 30.79 ms)  27.71 ms █▃ █      ▃          
                    (  7.16 mb …  10.80 mb)   9.07 mb █████▄▄██▁█▄▄▁█▁▄█▁█▄

                             ┌                                            ┐
                             ╷┌─────────┬─┐                               ╷
         hbs large (control) ├┤         │ ├───────────────────────────────┤
                             ╵└─────────┴─┘                               ╵
                               ╷  ┌───────────┬───────┐                ╷
      hbs large (experiment)   ├──┤           │       ├────────────────┤
                               ╵  └───────────┴───────┘                ╵
                             └                                            ┘
                             7.89 ms           18.62 ms            29.35 ms

summary
  hbs large (control)
   1.2x faster than hbs large (experiment)

@NullVoxPopuli
Copy link
Copy Markdown
Member

NOTE: benchmark is wildly unstable on CI -- for good results, you'll want to run locally

Copy link
Copy Markdown
Member

@evoactivity evoactivity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine

@NullVoxPopuli NullVoxPopuli merged commit 4b89849 into main Mar 15, 2026
34 checks passed
@NullVoxPopuli NullVoxPopuli deleted the copilot/convert-library-to-esm branch March 15, 2026 23:05
@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Mar 15, 2026
Copilot AI added a commit that referenced this pull request Mar 15, 2026
@github-actions github-actions Bot mentioned this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants